#!/usr/bin/env python
# encoding: utf-8
from feature_conf.loan import LoanConfigConstant
from utils import extract_bill_normal_features, extract_bill_status_features


class LoanIdPreV1():

    @staticmethod
    def get_features(data):
        cate_df = data['pre_repay_df']
        normal_df = data['normal_installment_df']
        day_features_dict = {}
        for day in LoanConfigConstant.BILL_DAYS_LIST:
            day_feature = extract_bill_normal_features(cate_df=cate_df, normal_df=normal_df,
                                                       time_col='day_inter', time_inter=day,
                                                       feature_type='pre',
                                                       country_id='id', version='v1')
            day_features_dict.update(day_feature)
            day_status_feature = extract_bill_status_features(cate_df=cate_df, normal_df=normal_df,
                                                              time_col='day_inter', time_inter=day,
                                                              feature_type='pre', sub_time_col='pre_days',
                                                              country_id='id', version='v1')
            day_features_dict.update(day_status_feature)

        return day_features_dict
